<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>机构信息</title>
<%@include file="/common/wxCommon.jspf"%>
<style>
.weui_label {
	width: 6em;
}

.weui-col-100 {
	text-align: center;
}
input:disabled {
	background-color: white;
}
.w100 {
	width: 100%;
}
</style>
</head>
<body>
	<div class="weui-row weui-no-gutter header-bg">
		<div class="weui-col-100">
			<c:choose>
				<c:when test="${orgInfo.status eq 0 }">
					<i class="weui_icon_msg weui_icon_waiting"></i>
				</c:when>
				<c:when test="${orgInfo.status eq 1 }">
					<i class="weui_icon_safe weui_icon_safe_success"></i>
				</c:when>
				<c:when test="${orgInfo.status eq 2 }">
					<i class="weui_icon_msg weui_icon_warn"></i>
				</c:when>
			</c:choose>
		</div>
	</div>
	<div class="weui_cells mg0">
		<div class="weui_cell">
			<div class="weui_cell_hd">
				<label class="weui_label">审核状态:</label>
			</div>
			<div class="weui_cell_bd gray">
				<c:choose>
					<c:when test="${orgInfo.status eq 0 }"><b style="color: #10aeff">待审核</b></c:when>
					<c:when test="${orgInfo.status eq 1 }"><b style="color: #09bb07">审核通过</b></c:when>
					<c:when test="${orgInfo.status eq 2 }"><b style="color: #f43530">审核拒绝</b></c:when>
				</c:choose>
			</div>
		</div>
		<div class="weui_cell">
			<div class="weui_cell_hd">
				<label class="weui_label">机构名称:</label>
			</div>
			<div class="weui_cell_bd gray">${orgInfo.orgName }</div>
		</div>
		<div class="weui_cell">
			<div class="weui_cell_hd">
				<label class="weui_label">机构代码:</label>
			</div>
			<div class="weui_cell_bd gray">${orgInfo.orgCode }</div>
		</div>
		<div class="weui_cell">
			<div class="weui_cell_hd">
				<label class="weui_label">法人代表:</label>
			</div>
			<div class="weui_cell_bd gray">${orgInfo.owner }</div>
		</div>
		<div class="weui_cell">
			<div class="weui_cell_hd">
				<label class="weui_label">注册地区:</label>
			</div>
			<div class="weui_cell_bd gray">${orgInfo.province}${orgInfo.city}${orgInfo.area}${orgInfo.street}</div>
		</div>
		<div class="weui_cell">
			<div class="weui_cell_hd">
				<label class="weui_label">注册地址:</label>
			</div>
			<div class="weui_cell_bd gray">${orgInfo.address}</div>
		</div>
		<div class="weui_cell">
			<div class="weui_cell_hd">
				<label class="weui_label">机构类型:</label>
			</div>
			<div class="weui_cell_bd gray">
				<c:forEach items="${orgTypeList }" var="record">
					<c:if test="${record.value eq orgInfo.orgType }">
						${record.label}&nbsp;${orgInfo.otherType}
					</c:if>
				</c:forEach>
			</div>
		</div>
		<div class="weui_cell">
			<div class="weui_cell_hd">
				<label class="weui_label">通讯地址:</label>
			</div>
			<div class="weui_cell_bd gray">${orgInfo.contactAddress}</div>
		</div>
		<div class="weui_cell">
			<div class="weui_cell_hd">
				<label class="weui_label">注册时间:</label>
			</div>
			<div class="weui_cell_bd gray">
				<fmt:formatDate pattern="yyyy-MM-dd" value="${orgInfo.regDate }" />
			</div>
		</div>
		<div class="weui_cell">
			<div class="weui_cell_bd weui_cell_primary">
				<textarea class="weui_textarea" disabled="disabled" rows="5">${orgInfo.otherService }</textarea>
			</div>
		</div>
		<div class="weui_cell">
			<div class="weui_cell_hd">
				<label class="weui_label">机构公众号:</label>
			</div>
			<div class="weui_cell_bd gray">${orgInfo.orgWeixin}</div>
		</div>
		
		<div class="weui_cell">
			<div class="weui_cell_hd">
				<label class="weui_label">联&nbsp;&nbsp;系&nbsp;&nbsp;人:</label>
			</div>
			<div class="weui_cell_bd weui_cell_primary gray">
				<input type='text' class='weui_input' name="orgInfoFormMap.contact" value="${orgInfo.contact }" disabled="disabled"/>
			</div>
			<div class="weui_cell_ft">
				<img class="weui_media_appmsg_thumb img-edit" src="${ctx }/images/weixin/edit.png">
				<i class='weui_icon_success_circle hide'></i><i class='weui_icon_cancel hide' val="${orgInfo.contact }"></i>
			</div>
		</div>
		<div class="weui_cell">
			<div class="weui_cell_hd">
				<label class="weui_label">联系方式:</label>
			</div>
			<div class="weui_cell_bd weui_cell_primary gray">
				<input type="number" class='weui_input' name="orgInfoFormMap.phone" value="${orgInfo.phone }" disabled="disabled"/>
			</div>
			<div class="weui_cell_ft">
				<img class="weui_media_appmsg_thumb img-edit" src="${ctx }/images/weixin/edit.png">
				<i class='weui_icon_success_circle hide'></i><i class='weui_icon_cancel hide' val="${orgInfo.phone }"></i>
			</div>
		</div>
		<div class="weui_cell">
			<div class="weui_cell_hd">
				<label class="weui_label">电子邮件:</label>
			</div>
			<div class="weui_cell_bd gray">${orgInfo.email}</div>
		</div>
		<c:if test="${not empty accountName }">
		<div class="weui_cell">
			<div class="weui_cell_hd">
				<label class="weui_label">管理账号:</label>
			</div>
			<div class="weui_cell_bd gray">${accountName}</div>
		</div>
		</c:if>
		<div class="weui_cell">
			<div class="weui_cell_hd">
				<label class="weui_label">邀请码:</label>
			</div>
			<div class="weui_cell_bd">
				<c:forEach var="record" items="${codeList }">
					<c:choose>
						<c:when test="${empty record.useOpenid }">
							<i class="code-unused">${record.code }</i>&nbsp;
						</c:when>
						<c:otherwise>
							<s class="code-used">${record.code }</s>&nbsp;
						</c:otherwise>
					</c:choose>
				</c:forEach>
			</div>
		</div>
	</div>
	<script type="text/javascript">
	$(function(){
		$(".img-edit").click(function(){
			var ele = $(this).parent().prev().children(".weui_input");
			ele.attr("disabled",false);
			ele.focus();
			$(this).siblings().removeClass("hide");
			$(this).addClass("hide");
		});
		
		$("i.weui_icon_cancel").click(function(){
			var ele = $(this).parent().prev().children(".weui_input");
			ele.val($(this).attr("val"));
			ele.attr("disabled",true);
			$(this).parent().children("img").removeClass("hide");
			$(this).parent().children("i").addClass("hide");
		});
		
		$("i.weui_icon_success_circle").click(function(){
			var $this = $(this);
			var ele = $(this).parent().prev().children(".weui_input");
			if (ele.val() == "") {
				$.alert("请正确填写内容");
				return false;
			}
			var json = eval("({'orgInfoFormMap.id': '${orgInfo.id}', '" + ele.attr("name") + "' : '" + ele.val() + "'})");
			$.post("${ctx}/weixin/organ/edit.shtml", json,function(data){
				if (data == "\"success\"") {
					ele.attr("disabled",true);
					$this.parent().children("img").removeClass("hide");
					$this.parent().children("i").addClass("hide");
				} else {
					$.alert("保存失败");
				}
			});
		});
	});
	</script>
</body>
</html>